﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_AdminLayOut.cshtml";
}
@model List<UcAsp.Models.Articles>
<script>
    $(document).ready(function () {
        $("#addcontent").click(function () {
            $.get("/ContentManager/GetContent?type=Teach", function (dataresult) {
                $.facebox(dataresult, "ucaspfacebox");
            })
        });
        $(".artedit").click(function () {
            $.get("/ContentManager/GetContent?type=Teach&ID=" + $(this).attr("data-id"), function (dataresult) {
                $.facebox(dataresult, "ucaspfacebox");
            })
        });
        $(".showart").click(function () {
            $.post("/ContentManager/ShowArticle", { ID: $(this).attr("data-id"), Release: $(this).attr("data-release") }, function (dataresult) {
                location.href = "/TeachManager/teach";
            })
        });
        $(".showrecommend").click(function () {
            $.post("/ContentManager/Recommend", { ID: $(this).attr("data-id"), Recommend: $(this).attr("data-recommend") }, function (dataresult) {
                location.href = "/TeachManager/teach";
            })
        });

    })

</script>
<h2>教师管理</h2>
 
<input class="button" id="addcontent" type="button" value=" 添加教师 " />
<div class="content-box">
     <div class="content-box-header">
        <h3>教师管理</h3>
        <div class="clear"></div>
      </div>
    <table>
            <thead>
              <tr>
                <th style="width:50%">教师名字</th>
                 <th>点击</th>
                <th>发布日期</th>
                  <th>推荐</th>
                  <th>是否</th>
                <th>操作</th>
              </tr>
            </thead>
            <tfoot>
              <tr>
                <td colspan="6">
                  <div class="pagination"> 
                      <a href="/TeachManager/teach?page=1" title="First Page">&laquo; 第一页</a>
                     @for (int i = 1; i < int.Parse(ViewData["PageCount"].ToString())+1;i++ )
                     {
                       <a href="/TeachManager/teach?page=@i" class="number @if (ViewData["PageIndex"].ToString()==@i.ToString())
                                                 {<text>current</text>}" title="@i">@i</a>
                     }
                      <a href="/TeachManager/teach?page=@ViewData["PageCount"]" title="Last Page">最后一页 &raquo;</a> </div>
                  <!-- End .pagination -->
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            <tbody>
                @foreach (UcAsp.Models.Articles art in Model)
                {
                  <tr>
                    <td>@art.Title
                     </td>
                    <td>@art.Hot</td>
                      <td>@art.AddDatetime.ToShortDateString()</td>
                    <td> <a href="#" class="showrecommend" data-id="@art.ID" data-recommend="@art.IsRecommend">@if (@art.IsRecommend)
                                                                                                                 {<img src="/content/resources/images/hot.png"  />}
                                                                                                   else
                                                                                                   {<img src="/content/resources/images/nohot.png"  />}</a></td>
                      
                     <td> <a href="#" class="showart" data-id="@art.ID" data-release="@art.IsRelease">@if (@art.IsRelease){<img src="/content/resources/images/iconsyes.gif"  />}
                                                                                                   else
                                                                                                   {<img src="/content/resources/images/iconsno.gif"  />}</a></td>
                    <td>
                      <!-- Icons -->
                      
                       <a href="#" class="artedit" data-id="@art.ID" title="Edit"><img src="/content/resources/images/icons/pencil.png" alt="Edit" /></a> <a href="#" title="Delete"><img src="/content/resources/images/icons/cross.png" alt="Delete" /></a> </td>
                  </tr>
                }
            </tbody>
          </table>



</div>

